import time

# from app import celery
from celery_task.celery_init import celery
from insects_detection.insects_utils import insects_tools
from insects_detection.pic_utils import pic_tools
import json

@celery.task(bind=True,name="celery_task.imgprocess")
def process_originnal_imgs(self,gallery_path,processed_gallery_path):
    pic_tools.write_all_processed_imgs(gallery_path, processed_gallery_path,True,self)

@celery.task(bind=True,name="celery_task.sticky_card_process")
def process_sticky_card_imgs(self,image_path,enable_cache=False,redis_obj=None,store_local=True):
    insects_total, img_url, abs_store_path = insects_tools.get_labelled_insects_count_image(image_path,enable_cache,redis_obj,self)
    return {'current': insects_total, 'total': insects_total, 'status': 'Task completed!',
            'result': img_url}